package chatgpt

import (
	"github.com/gin-gonic/gin"
	"net/http"
	chatgpt3_5 "zy_bot_demo/chatgpt3.5"
)

type MessageReq struct {
	Req string `json:"req"`
}

func StartChatGpt() {
	engine := gin.Default()

	engine.POST("/chatgpt", func(ctx *gin.Context) {
		var req MessageReq
		ctx.ShouldBindJSON(&req)
		println(req.Req)
		message, _ := chatgpt3_5.SendMessage(req.Req)
		ctx.JSON(http.StatusOK, gin.H{
			"message": message,
		})
	})

	engine.Run()
}
